package cn.dankal.flyaudio.adapter;

import android.view.View;
import android.view.ViewGroup;

import cn.dankal.basiclib.base.recyclerview.BaseRecyclerViewAdapter;
import cn.dankal.basiclib.base.recyclerview.BaseRecyclerViewHolder;
import cn.dankal.basiclib.pojo.ProductDetailItemEntity;
import cn.dankal.flyaudio.R;

public class ConfirmOrderProductAdapter extends BaseRecyclerViewAdapter<ProductDetailItemEntity> {

    @Override
    protected int getLayoutResId(int viewType) {
        return R.layout.item_confirm_order_products;
    }

    @Override
    protected BaseRecyclerViewHolder getViewHolder(ViewGroup parent, View rootView, int viewType) {
        return new ViewHolder(rootView);
    }


    public class ViewHolder extends BaseRecyclerViewHolder<ProductDetailItemEntity> {

        public ViewHolder(View itemView) {
            super(itemView);
        }

        @Override
        public void onBindData(ProductDetailItemEntity data, int position) {
            setImageUrl(R.id.iv_order_img, data.getImgUrl());
            setText(R.id.tv_product_name, data.getProductName());
            setText(R.id.tv_sku, "");
            setText(R.id.tv_product_price, "¥" + data.getDiscountedUnitPrice());
            setText(R.id.tv_score, data.getCanUseScore() + "");
            setText(R.id.tv_num, "X  " + data.getItemCount());
        }
    }
}
